<?php

	/**
	* 
	*/
	class Result_model extends CI_Model
	{
		function __construct()
		{
			$this->load->database();
		}
		/*根据活动id取出这个活动全部的结果*/
		function getQuesInfo($iActId)
		{
			$query = $this->db->get_where('result',array('iActId' => $iActId));
			return $query->result_array();
		}
		/*根据用户$vcUserId参与的所有活动的问题*/
		function getQuesInfoByUser($vcUserId)
		{
			$query = $this->db->get_where('result',array('vcUserId' => $vcUserId));
			return $query->result_array();
		}
		/*插入一条问卷结果*/
		/*$data数组包括活动Iid，普通用户id，选出的结果*/
		function insertResult($data)
		{
			$this->db->insert('result',$data);
		}
		/*根据用户id取出用户所参加的活动*/
		function getActId($vcUserId){
			$sql = "SELECT iActId FROM result WHERE vcUserId = ?";
			$query = $this->db->query($sql, $vcUserId);
			return $query->result_array();
		}
		function getActNum($vcUserId){
			$sql = "SELECT iActId FROM result WHERE vcUserId = ?";
			$query = $this->db->query($sql, $vcUserId);
			return $query->num_rows();
		}
	}